@extends('admin.layout.main')

@section('content')
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="#">委托管理</a>
	</li>
	<li class="active"><a href="{{ url('admin/entrust_list') }}">委托列表</a></li>
</ul><!-- /.breadcrumb -->

<div class="nav-search" id="nav-search">
	<form class="form-search">
		<span class="input-icon">
		<input type="text" placeholder="搜索" class="nav-search-input" id="nav-search-input" autocomplete="off" />
			<i class="ace-icon fa fa-search nav-search-icon"></i>
		</span>
	</form>
</div><!-- /.nav-search -->
</div>
<form class="form-search" action="/admin/entrust_list" method="post">
    <span class="page-content">选择币种：</span>
    <span class="input-icon">
        <input type="hidden" name="_token" value="{{csrf_token()}}"/>
        <select name="cid" id="">
            @foreach($price as $k=>$v)
                <option value="{{$v->id}}">{{$v->name_en}}</option>
            @endforeach
        </select>
	</span>
    <span class="page-content">交易类型：</span>
    <select name="type" id="">
    <option value="">全部</option>
    <option value="3">买入</option>
    <option value="4">卖出</option>
    </select>
    <span class="page-content">交易状态：</span>
    <select name="status" id="">
        <option value="">全部</option>
        <option value="1">未成交</option>
        <option value="2">部分成交</option>
        <option value="3">已成交</option>
        <option value="4">部分撤销</option>
        <option value="5">全部撤销</option>
    </select>
    <span class="page-content">委托人id：</span>
    <input type="text"  name="like_account" value="" class="nav-search-input" id="nav-search-input" autocomplete="off" />
    <button class="btn btn-info" type="submit" >
        查找
    </button>
    </span>
</form>
<div class="page-content">
	<div class="row">
		<div class="col-xs-12">
			<!-- PAGE CONTENT BEGINS -->
			<div class="row">
				<div class="col-xs-12">
					<div class="clearfix">
						<div class="pull-right tableTools-container"></div>
					</div>
					<div class="table-header">
						{{--<a href="{{ url('admin/currency_add_view') }}">--}}
						{{--<i class="menu-icon fa fa-plus orange"></i>--}}
						{{--<span class="menu-text orange"> 添加币种 </span>--}}
						{{--</a>--}}
					</div>

					<!-- div.table-responsive -->

					<!-- div.dataTables_borderWrap -->
					<div>
						<table id="dynamic-table" class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>序号</th>
									<th>委托编号</th>
									<th>委托人ID</th>
									<th>币种</th>
									<th>类型</th>
									<th>价格</th>
									<th>挂单数量</th>
									<th>成交数量</th>
									<th>手续费</th>

									<th>
										<i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>
										挂单时间
									</th>
									<th>
										<i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>
										成交时间
									</th>
									<th>状态</th>

									<th class="hidden-480" align="center">操作</th>

									{{--<th></th>--}}
								</tr>
							</thead>

							<tbody>
							@foreach($data as $key=>$val)
								<tr align="center">
									<td align="center">
										<a href="#">{{$key+1}}</a>
									</td>
									<td align="center">{{$val['number_no']}}</td>
									<td align="center">{{$val['account']}}</td>
									<td align="center">{{$val['name_en']}}</td>
									<td  align="center">
										@if($val['type']==3)
											买入
										@else
											卖出
										@endif
									</td>
									<td align="center">{{$val['price']}}</td>
									<td align="center">{{$val['num']}}</td>
									<td align="center">{{$val['deal']}}</td>
									<td align="center">{{$val['proc']}}</td>
									<td align="center">{{$val['created_at']}}</td>
									<td align="center">

										{{$val['deal_time']}}</td>
									<td  align="center">{{\App\Models\Entrust::$STATUS[$val['status']]}}
										{{--@if($val->status==1)--}}
											{{--未成交--}}
										{{--@elseif($val->status==3)--}}
											{{--已卖出--}}
										{{--@elsei--}}
											{{--部分成交--}}
										{{--@endif--}}
									</td>

									{{--<td>--}}
									{{--{{ date("Y-m-d H:i:s",$val->time)}}--}}
									{{--</td>--}}
									<td><div class="hidden-sm hidden-xs action-buttons">
											{{--<a class="blue" href="#">--}}
												{{--<i class="ace-icon fa fa-search-plus bigger-130"></i>--}}
											{{--</a>--}}
											{{--<a href="admin-index-control_del?id={{$val->admin_id}}">删除</a>--}}

											@if($val['status'] !=1 and $val['status'] !=5)
												<a class="green" href="entrust_details?id={{$val['id']}}">
													<i class="ace-icon fa fa-pencil bigger-130">查看</i>{{csrf_field()}}
												</a>
											@endif
											@if($val['status']==1)
												<a href="javascript:void(0)" class="red" onclick="undo({{$val['id']}},2)">
													<i class="ace-icon fa fa-trash-o bigger-130">全部撤销</i>
												</a>
											@endif
											@if($val['status']==2)
												<a href="javascript:void(0)" class="red" onclick="undo({{$val['id']}},1)">
													<i class="ace-icon fa fa-trash-o bigger-130">部分撤销</i>
												</a>
											@endif

										</div>

										<div class="hidden-md hidden-lg">
											<div class="inline pos-rel">
												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">
													<i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>
												</button>

												<ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
													{{--<li>--}}
														{{--<a href="#" class="tooltip-info" data-rel="tooltip" title="View">--}}
															{{--<span class="blue">--}}
																{{--<i class="ace-icon fa fa-search-plus bigger-120"></i>--}}
															{{--</span>--}}
														{{--</a>--}}
													{{--</li>--}}

													<li>
														<a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">
															<span class="green">
																<i class="ace-icon fa fa-pencil-square-o bigger-120"></i>
															</span>
														</a>
													</li>

													{{--<li>--}}
														{{--<a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">--}}
															{{--<span class="red">--}}
																{{--<i class="ace-icon fa fa-trash-o bigger-120"></i>--}}
															{{--</span>--}}
														{{--</a>--}}
													{{--</li>--}}
												</ul>
											</div>
										</div>
									</td>
								</tr>
							@endforeach
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<!-- PAGE CONTENT ENDS -->
		</div><!-- /.col -->


		<div class="modal-footer no-margin-top">
			{{--<ul class="pagination pull-right no-margin">--}}
				{{--<li class="prev disabled">--}}
					{{--<a href="#">--}}
						{{--<i class="ace-icon fa fa-angle-double-left"></i>--}}
					{{--</a>--}}
				{{--</li>--}}

				{{--<li class="active">--}}
					{{--<a href="#">1</a>--}}
				{{--</li>--}}

				{{--<li>--}}
					{{--<a href="#">2</a>--}}
				{{--</li>--}}

				{{--<li>--}}
					{{--<a href="#">3</a>--}}
				{{--</li>--}}

				{{--<li class="next">--}}
					{{--<a href="#">--}}
						{{--<i class="ace-icon fa fa-angle-double-right"></i>--}}
					{{--</a>--}}
				{{--</li>--}}
			{{--</ul>--}}
            @if(empty($url))
                {{$result->links()}}
            @else
                {{$result->appends($url)->links()}}
            @endif

		</div>
	</div><!-- /.row -->
</div><!-- /.page-content -->
	<script>

        //询问框
        // layer.confirm('您是如何看待前端开发？', {
        //     btn: ['重要','奇葩'] //按钮
        // }, function(){
        //     layer.msg('的确很重要', {icon: 1});
        // }, function(){
        //     layer.msg('也可以这样', {
        //         time: 20000, //20s后自动关闭
        //         btn: ['明白了', '知道了']
        //     });
        // });
        function undo(id,type){
            layer.confirm('确认撤销?',{
                btn: ['确定','取消'] //按钮
            },function(){
                $.ajax({
                    url:'/admin/entrust_undo?id=id&type=type',
                    type : "get",
                    data:{ id : id,type:type },
                    //dataType:'array',
                    success:function(res){
                        //window.print(res)
                        if(res.status == 1){
                            layer.msg( res.msg, {icon: 1});
                            location.href= '/admin/entrust_list'
                        }else {
                            layer.msg( res.msg, {icon: 2});
                        }
                    }
                });
            },function(){
                //取消
            })}
	</script>

@endsection
